package com.fqgj.sentry.policy.enums;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2017/7/19
 * Time: 下午5:23
 */
public enum PolicyTypeEnum {
    rules(1, "规则组"),
    grade(2, "评分卡");

    private int type;
    private String desc;


    PolicyTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public PolicyTypeEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public PolicyTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static PolicyTypeEnum getEnumByType(int type) {
        PolicyTypeEnum policyTypeEnum = null;
        for (PolicyTypeEnum e : PolicyTypeEnum.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return policyTypeEnum;
    }
}
